import { Component, OnInit } from '@angular/core'
import { StoreInfo } from '@shared/interfaces/post-risk-control'
import { NzMessageService } from 'ng-zorro-antd'
import { I18NService } from '@core'
import { Router, ActivatedRoute } from '@angular/router'
import { STColumn } from '@delon/abc'
import { DataService } from '@shared/services/data.service'

@Component({
  selector: 'app-tab-mcc',
  templateUrl: './tab-mcc.component.html',
  styleUrls: ['../../../../shared/styles/table.less'],
})
export class TabMccComponent implements OnInit {
  data: StoreInfo[]
  columns: STColumn[] = [
    {
      title: '层级',
      i18n: 'GENERAL.MCC.LEVEL',
      index: 'level',
      width: '150px',
      className: 'text-center',
    },
    {
      title: '层级ID',
      i18n: 'GENERAL.MCC.LEVEL_ID',
      index: 'num',
      width: '150px',
      className: 'text-center',
    },
    {
      title: '名称',
      i18n: 'GENERAL.MCC.NAME',
      index: 'name',
      width: '150px',
      className: 'text-center',
    },
    {
      title: '英文名称',
      i18n: 'GENERAL.MCC.NAME_EN',
      index: 'nameEN',
      width: '150px',
      className: 'text-center',
    },
  ]

  constructor(
    public msg: NzMessageService,
    public i18n: I18NService,
    public router: Router,
    public route: ActivatedRoute,
    private dataService: DataService,
  ) {}

  ngOnInit() {
    this.data =
      this.dataService.currentPostRisk$.value.storeInfoList || this.dataService.origPostRisk$.value.storeInfoList
  }
}
